#ifndef GUY_H
#define GUY_H

#include "Bullet.h"
#include <QSharedDataPointer>
#include <QFileInfo>
#include <QGraphicsItem>
#include <QGraphicsScene>
#include <QMap>
#include <QPainter>
#include <QList>
#include <QPointF>
#include <QPixmap>
#include <QRectF>
#include <QDebug>

class Guy : public QGraphicsItem
{

public:
    Guy(){ };
    Guy(QGraphicsScene *scene);
    Guy(const Guy &);

    virtual QRectF boundingRect() const;
    virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr);
    void setState(double ro);
    void Shooting();
    void UpdateAni();
    QList<Bullet*> bulletlist;

    QPixmap pix;
    int isdeath;

    QString root;
    int shootspeeed;
    int shootrecord;

    // 初始化弹夹

    // 用来存储小人走路三种状态的图片
    QList<QList<QString>> state;
    int state_index1;  // 记录小人面向的方向
    int state_index2;  // 记录小人当前处于哪一种移动状态
    int state_time;

    QPointF position;
    double rotate;
    double opacity;

    // 死亡后的尸体
    QPixmap guydeadbody;
};

#endif // GUY_H
